﻿//-----------------------------------------------------------------------
// <copyright file="IMergeCellInternal.cs" company="LMT">
//     Copyright (c) by La Minh Thuận.
// </copyright>
// <author>thuanla1985@hotmail.com</author>
//-----------------------------------------------------------------------
namespace LMT.Forms
{
    using System;

    /// <summary>
    /// A enum define rules of merge in MergeGridView
    /// </summary>
    public enum MergeRule
    {
        /// <summary>
        /// MergeGridView will merge all cell in specify column has a same content.
        /// </summary>
        Content = 0,

        /// <summary>
        /// MergeGridView will fire a event merging for user define owner merge rule.
        /// </summary>
        Owner = 1
    }

    /// <summary>
    /// A enum define rules of merge direction in MergeGridView
    /// </summary>
    public enum MergeDirection
    {
        /// <summary>
        /// Default. Not merge
        /// </summary>
        None = 0,

        /// <summary>
        /// Merge cells by direction direction.
        /// </summary>
        Vertical = 1,

        /// <summary>
        /// Merge cells by horizontal direction.
        /// </summary>
        Horizontal = 2,

        /// <summary>
        /// Merge cells by two directions.
        /// </summary>
        Both = 3
    }

    /// <summary>
    /// EventArags para for cell merging
    /// </summary>
    public class CellMergeEventArgs : EventArgs
    {
        /// <summary>
        /// Initializes a new instance of the <see cref="CellMergeEventArgs"/> class.
        /// </summary>
        internal CellMergeEventArgs()
        {
        }

        /// <summary>
        /// Initializes a new instance of the <see cref="CellMergeEventArgs"/> class.
        /// </summary>
        /// <param name="currentColumn">The current column.</param>
        /// <param name="currentRow">The current row.</param>
        internal CellMergeEventArgs(int currentColumn, int currentRow)
        {
            if (currentRow == 0)
            {
                this.IsFirstRow = true;
            }

            if (currentColumn == 0)
            {
                this.IsFirstColumn = true;
            }

            this.ColumnIndex = currentColumn;
            this.RowIndex = currentRow;
        }

        /// <summary>
        /// Gets or sets a value indicating whether this instance is vertical merge.
        /// </summary>
        /// <value>
        ///   <c>true</c> if this instance is vertical merge; otherwise, <c>false</c>.
        /// </value>
        public bool IsVMergeNext { get; set; }

        /// <summary>
        /// Gets or sets a value indicating whether this instance is vertical merge previous.
        /// </summary>
        /// <value>
        ///   <c>true</c> if this instance is vertical merge previous; otherwise, <c>false</c>.
        /// </value>
        public bool IsVMergePrevious { get; set; }

        /// <summary>
        /// Gets or sets a value indicating whether this instance is horizontal merge next.
        /// </summary>
        /// <value>
        ///   <c>true</c> if this instance is horizontal merge; otherwise, <c>false</c>.
        /// </value>
        public bool IsHMergeNext { get; set; }

        /// <summary>
        /// Gets or sets a value indicating whether this instance is horizontal merge previous.
        /// </summary>
        /// <value>
        ///   <c>true</c> if this instance is H merge previous; otherwise, <c>false</c>.
        /// </value>
        public bool IsHMergePrevious { get; set; }

        /// <summary>
        /// Gets or sets a value indicating whether this instance is end merge.
        /// </summary>
        /// <value>
        ///   <c>true</c> if this instance is end merge; otherwise, <c>false</c>.
        /// </value>
        public bool IsEndMerge { get; set; }

        /// <summary>
        /// Gets or sets the index of the current row.
        /// </summary>
        /// <value>The index of the current row.</value>
        public int RowIndex { get; set; }

        /// <summary>
        /// Gets or sets the index of the column.
        /// </summary>
        /// <value>The index of the column.</value>
        public int ColumnIndex { get; set; }

        /// <summary>
        /// Gets a value indicating whether this instance is first row.
        /// </summary>
        /// <value>
        ///   <c>true</c> if this instance is last row; otherwise, <c>false</c>.
        /// </value>
        public bool IsFirstRow { get; internal set; }

        /// <summary>
        /// Gets a value indicating whether this instance is first column.
        /// </summary>
        /// <value>
        ///   <c>true</c> if this instance is first column; otherwise, <c>false</c>.
        /// </value>
        public bool IsFirstColumn { get; internal set; }

        /// <summary>
        /// Gets a value indicating whether this instance is last column.
        /// </summary>
        /// <value>
        ///   <c>true</c> if this instance is last column; otherwise, <c>false</c>.
        /// </value>
        public bool IsLastColumn { get; internal set; }

        /// <summary>
        /// Gets a value indicating whether this instance is last row.
        /// </summary>
        /// <value>
        ///   <c>true</c> if this instance is last row; otherwise, <c>false</c>.
        /// </value>
        public bool IsLastRow { get; internal set; }
    }
}
